﻿@model PagedList.IPagedList<MvcApplication2.Models.BuildItem>
@using PagedList.Mvc; 

<link href="~/Content/PagedList.css" rel="stylesheet" type="text/css" />

@{
    ViewBag.Title = "BuildItems";
}

<h2>Build Items</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>

@*@using (Html.BeginForm())
{
    <p>
        Find by name: @Html.TextBox("SearchString")  
        <input type="submit" value="Search" /></p>
}*@

@using (Html.BeginForm("Index", "BuildItem", FormMethod.Get))
{
    <p>
        Find by name: @Html.TextBox("SearchString", ViewBag.CurrentFilter as string)  
        <input type="submit" value="Search" />
    </p>
}



<table>
    
    <tr>
        <th>
            @Html.ActionLink("Package Name", "Index", new { sortOrder = ViewBag.NameSortParm, currentFilter=ViewBag.CurrentFilter })
        </th>

        <th>
            @Html.ActionLink("Package ID", "Index", new { sortOrder = ViewBag.DateSortParm, currentFilter=ViewBag.CurrentFilter })
        </th>
            
        <th>
            Package Name
        </th>
        <th>
            @*@Html.DisplayNameFor(model => model.CommandLine)*@
            Command Line
        </th>
        <th>
            @*@Html.DisplayNameFor(model => model.WorkingDir)*@
            Working Dir
        </th>
        <th>
            @*@Html.DisplayNameFor(model => model.CreationDate)*@
            Creation Date
        </th>
        <th></th>
    </tr>

    @*    <tr>
        <th>
            Package ID
        </th>
        <th>
            @Html.DisplayNameFor(model => model.PackageName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.HumanReadableAppName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CommandLine)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.WorkingDir)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CreationDate)
        </th>
        <th></th>
    </tr>*@

    @foreach (var item in Model) {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.HumanReadableAppName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.AppMapPackageId)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.PackageName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.CommandLine)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.WorkingDir)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.CreationDate)
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id=item.BuildItemId }) |
                @Html.ActionLink("Details", "Details", new { id=item.BuildItemId }) |
                @Html.ActionLink("Delete", "Delete", new { id=item.BuildItemId })
            </td>
        </tr>
    }

</table>
<br />

Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount
@Html.PagedListPager(Model, page => Url.Action("Index", new { page, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter }) )
